package win.bigwhale.sudoku.sound;

import javafx.scene.media.MediaPlayer;

public class SoundPlayerImp implements SoundPlayer {
	private MediaPlayer mMediaPlayer = null;
	
	public SoundPlayerImp(MediaPlayer mediaPlayer) {
		mMediaPlayer = mediaPlayer;
		mMediaPlayer.setCycleCount(1);
	}

	public SoundPlayerImp(MediaPlayer mediaPlayer, int cycle) {
		mMediaPlayer = mediaPlayer;
		mMediaPlayer.setCycleCount(MediaPlayer.INDEFINITE);
	}

	@Override
	public void play() {
		mMediaPlayer.play();
	}

	@Override
	public void pause() {
		mMediaPlayer.pause();
	}

	@Override
	public void resume() {
		mMediaPlayer.play();
	}

	@Override
	public void restart() {
		mMediaPlayer.stop();
		mMediaPlayer.play();
	}

	@Override
	public void stop() {
		mMediaPlayer.stop();
	}

}
